package com.joesem.sale.client.network

import com.joesem.sale.client.network.data.*
import okhttp3.MultipartBody
import retrofit2.http.*

interface Api {
    @POST("login")
    suspend fun login(@Body value: HashMap<String, String>): CallResponse<AccountMode?>

    @POST("user/logout")
    suspend fun logout(): CallResponse<Any?>

    @POST("user/cid")
    suspend fun userGTCid(@Body values: HashMap<String, String>): CallResponse<Any?>

    @GET("wos")
    suspend fun workOrderList(
        @Query("date_type") date_type: String? = null,
        @Query("date_start") date_start: String? = null,
        @Query("date_end") date_end: String? = null,
        @Query("about_me") about_me: String? = null,
        @Query("status") status: String? = null,
        @Query("type") type: String? = null,
        @Query("page") page: Int? = null,
        @Query("limit") limit: Int? = null,
    ): CallResponse<List<WorkOrderMode?>?>

    @GET("wos/{id}")
    suspend fun workOrderDetails(
        @Path("id") id: String? = null,
    ): CallResponse<OrderDetailsMode?>

    @GET("wos/params")
    suspend fun workOrderFilterParams(): CallResponse<WorkOrderParamsMode?>

    @GET("customers/params")
    suspend fun customerParams(): CallResponse<CustomerParamsMode?>

    @GET("customers")
    suspend fun getCustomerList(
        @Query("keyword") keyword: String? = null,
        @Query("page") page: Int? = null,
        @Query("limit") limit: Int? = null,
    ): CallResponse<List<CustomerListMode?>?>

    @GET("customers/{id}/products")
    suspend fun getCustomerProductList(
        @Path("id") id: String? = null,
        @Query("page") page: Int? = null,
        @Query("limit") limit: Int? = null,
    ): CallResponse<List<ProductMode?>?>

    @Multipart
    @POST("files/filesStore")
    suspend fun uploadFileOcr(
        @Part image: MultipartBody.Part,
    ): CallResponse<UploadImgMode?>

    @POST("wos")
    suspend fun createWorkOrder(@Body value: HashMap<String, Any?>): CallResponse<OrderCreateMode?>

    @GET("city/index")
    suspend fun area(@Query("pid") pid: Int?): CallResponse<List<AreaMode?>?>

    @POST("wos/{id}/start")
    suspend fun orderStart(@Path("id") id: Int?): CallResponse<OrderDetailsMode?>

    @POST("wos/{id}/accept")
    suspend fun orderAccept(@Path("id") id: Int?): CallResponse<OrderDetailsMode?>

    @POST("wos/{id}/allot")
    suspend fun orderAllot(
        @Path("id") id: Int?,
        @Body values: HashMap<String, Any?>,
    ): CallResponse<OrderDetailsMode?>

    @GET("boms")
    suspend fun getBomList(
        @Query("name") keyword: String? = null,
        @Query("status") status: Int? = null,
        @Query("page") page: Int? = null,
        @Query("limit") limit: Int? = null,
    ): CallResponse<Any?>

    @POST("wos/{id}/receipt")
    suspend fun orderReceipt(
        @Path("id") id: String?,
        @Body hashMap: HashMap<String, Any?>,
    ): CallResponse<OrderDetailsMode?>

    @GET("notifications")
    suspend fun noticeList(
        @Query("type") type: String, @Query("page") page: Int? = null,
        @Query("limit") limit: Int? = null,
    ): CallResponse<List<NoticeListMode?>?>

    @POST("notifications/{id}/mark_read")
    suspend fun noticeMarkRead(@Path("id") id: Int?): CallResponse<Any?>

    @GET("events/{id}")
    suspend fun eventDetails(@Path("id") id: Int?): CallResponse<EventDetailsMode?>

    @GET("dept/index")
    suspend fun getDept(): CallResponse<List<DeptMode?>?>

    @GET("dept/{id}/users")
    suspend fun getDeptUser(
        @Path("id") id: String?, @Query("page") page: Int? = null,
        @Query("limit") limit: Int? = null,
    ): CallResponse<List<DeptUserMode?>?>

    @POST("events/{id}/allot")
    suspend fun eventAllot(
        @Path("id") id: Int?,
        @Body value: HashMap<String, Any?>,
    ): CallResponse<EventDetailsMode?>

    @POST("events/{id}/receipt")
    suspend fun eventReturn(
        @Path("id") id: Int?,
        @Body value: HashMap<String, Any?>,
    ): CallResponse<EventDetailsMode?>

    @GET("events")
    suspend fun eventList(
        @Query("status") state: String? = null,
        @Query("type") type: String? = null,
        @Query("about_me") about_me: String? = null,
        @Query("date") date: String? = null,
        @Query("page") page: Int? = null,
        @Query("limit") limit: Int? = null,
    ): CallResponse<List<EventListMode?>?>

    @GET("events/params")
    suspend fun getEventParams(): CallResponse<EventParamsMode?>

    @GET("notifications/status_count")
    suspend fun noticeCount(): CallResponse<NoticeCountMode?>

    @GET("wos/status_counts")
    suspend fun orderStatsNum(): CallResponse<OrderStatsNumMode?>

    @GET("wo_rankings")
    suspend fun orderRanking(): CallResponse<List<OrderRankingMode?>?>

    @GET("index/getUserInfo")
    suspend fun account(): CallResponse<AccountMode?>

    @POST("customers")
    suspend fun createCustomer(@Body value: HashMap<String, Any?>): CallResponse<CustomerUserMode?>

    @POST("customer_users")
    suspend fun createContact(@Body value: HashMap<String, Any?>): CallResponse<ContactMode?>
}